#include "Vector.h"

//CREDIT FOR THESE GO TO Charles McEniry (no idea who that is)
//Amazing function, bro!
float Vector::invSqrt(float x){
	union { float f; unsigned long ul; } y; 
    y.f = x; 
    y.ul = ( 0xBE6EB50CUL - y.ul ) >> 1; 
    return 0.5f * y.f * ( 3.0f - x * y.f * y.f ); 
}

float Vector::invSqrtPrecise(float x){
	union { float f; unsigned long ul; } y; 
    y.f = x; 
    y.ul = ( 0xBE6EB50CUL - y.ul ) >> 1; 
	y.f = 0.5f * y.f * ( 3.0f - x * y.f * y.f );
    return 0.5f * y.f * ( 3.0f - x * y.f * y.f ); 
}